//
//  FansCenterViewController.m
//  快圈
//
//  Created by 宁宁 on 16/9/12.
//  Copyright © 2016年 ym. All rights reserved.
//

#import "FansCenterViewController.h"

#import "MineElseTableViewCell.h"//cell

#import "FansManagerViewController.h"//粉丝管理
#import "MineFansViewController.h"//我的粉丝团


#define Title @[@"粉丝管理", @"我的粉丝团"]

@interface FansCenterViewController () <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation FansCenterViewController

 static NSString *const MineElseTableViewCellID = @"MineElseTableViewCell";

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self setNav];
    
    [self registerTableView];
}

- (void)setNav{
    self.title = @"粉丝中心";
    UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    self.navigationItem.leftBarButtonItem = back;
}

- (void)registerTableView{
    [self.tableView registerNib:[UINib nibWithNibName:@"MineElseTableViewCell" bundle:nil] forCellReuseIdentifier:MineElseTableViewCellID];
}

#pragma mark === TableViewDelegate ===
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    MineElseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MineElseTableViewCellID];
//    cell.imageicon.image = [UIImage imageNamed:<#(nonnull NSString *)#>];
    cell.title.text = Title[indexPath.row];
    cell.arrow.hidden = YES;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        //粉丝管理
        FansManagerViewController *fans = [[FansManagerViewController alloc] init];
        fans.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:fans animated:YES];
    }else{
        //我的粉丝团
        MineFansViewController *mine = [[MineFansViewController alloc] init];
        mine.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:mine animated:YES];
    }
}

- (void)back{
    [self.navigationController popViewControllerAnimated:YES];
}

-(UITableView *)tableView{
    if (!_tableView) {
        _tableView= [[UITableView alloc]initWithFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)style:UITableViewStylePlain];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.separatorColor = [UIColor clearColor];
        _tableView.backgroundColor = RGBACOLOR(36, 34, 47, 1);
        _tableView.showsVerticalScrollIndicator = NO;//去掉滑动竖条
        [self.view addSubview:_tableView];
    }
    return _tableView;
}

@end
